// DriveNotes. Copyright (c) 2011, Andrei Senchuk. All rights reserved.
package net.taviscaron.drivenotes.server.service.endpoint;

import java.util.List;
import javax.jws.WebMethod;
import javax.jws.WebService;
import net.taviscaron.drivenotes.shared.exceptions.InvalidEntityException;
import net.taviscaron.drivenotes.shared.model.entity.Note;
import net.taviscaron.drivenotes.shared.model.entity.User;
import net.taviscaron.drivenotes.shared.service.NoteService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Note service impl
 * @author Andrei Senchuk
 */
@WebService(serviceName = "NoteService")
public class NoteServiceEndpoint implements NoteService {
    @Autowired
    private NoteService noteService;

    @WebMethod
    public List<Note> findNotesByUser(User user) {
        return noteService.findNotesByUser(user);
    }

    @WebMethod
    public Note findNote(Long id, User author) {
        return noteService.findNote(id, author);
    }

    @WebMethod
    public void saveNote(Note note) throws InvalidEntityException {
        noteService.saveNote(note);
    }

    @WebMethod
    public void removeNoteById(Long id) {
        noteService.removeNoteById(id);
    }
}
